package com.emergency.engine.controller;

import com.emergency.base.domain.Order;
import com.emergency.base.domain.Scenar;
import com.emergency.base.domain.Woven;
import com.emergency.engine.service.TeamService;
import com.emergency.common.entity.Result;
import com.emergency.common.entity.StatusCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by lijie on 2019/10/17.
 */
@RestController
@RequestMapping("/team")
@Api(value="分队救援推演类",description = "各大分队应急救援推演类，提供方案推演，更新推演数据")
public class TeamController {

    @Autowired
    private TeamService teamService;

    @ApiOperation(value = "分队施救推演" ,  notes="各分队接受命令，发送推演引擎，返回结果")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "scenar", value = "想定文件", required = true, paramType = "query"),
            @ApiImplicitParam(name = "woven", value = "作战分队", required = true, paramType = "query"),
            @ApiImplicitParam(name = "order", value = "指令", required = true, paramType = "query")
    })
    @RequestMapping(value = "deduction",method = RequestMethod.POST)
    public Result deduction(String scenarId, Woven woven, Order order){
        boolean flag=teamService.deductionPlan(scenarId,woven,order);
        return new Result(flag, StatusCode.OK,  "推演成功", "");
    }
}
